var _page = $('.page');

bottlecms.load({
    done: function (page, next) {
        bottlecms.get("/m/ajax/center/friend/newfriend", {
            page: page
        }, function (data) {
            var lis = [];
            for (var o in data.list) {
                lis.push(friend_apply_template(data.list[o]))
            }
            next(lis.join(''), lis.length);
        })
    }
}).init();


// 同意
$(_page).on('click', '.bcui-infinite-list .item .js_agree', function (event) {
    var target_id = $(this).attr('data-id')
    var _this = this;
    bottlecms.confirm("确定同意吗？", function () {
        agree_apply_friend_fun(target_id, function () {
            $(_this).parents(".item").attr('status', 1);
        });
    })
});
// 拒绝
$(_page).on('click', '.bcui-infinite-list .item .js_refuse', function (event) {
    var target_id = $(this).attr('data-id');
    var _this = this;
    bottlecms.confirm("确定拒绝吗？", function () {
        refuse_apply_friend_fun(target_id, function () {
            $(_this).parents(".item").attr('status', 2);
        });
    })
});